package com.example.smartcitydemo.ui.job

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.example.smartcitydemo.R
import com.example.smartcitydemo.bean.DeliverHistoryBean
import com.example.smartcitydemo.bean.JobListBean
import com.example.smartcitydemo.databinding.ItemHistoryItemBinding
import com.example.smartcitydemo.databinding.ItemWorkJobTypeBinding
import com.example.smartcitydemo.ui.job.fragment.ResumeManagerFragment
import com.example.smartcitydemo.ui.person.PersonFragment
import com.example.smartcitydemo.ui.person.PersonSettingFragment

/**
 * @PACKAGE_NAME: com.example.smartcitydemo.ui.job
 * @NAME: Caleb.F
 * @DATE: 2021/11/18 10:36
 * @Email: 1919796283@qq.com
 */

class JobListAdapter :
    BaseQuickAdapter<JobListBean, BaseDataBindingHolder<ItemWorkJobTypeBinding>>(R.layout.item_work_job_type) {
    override fun convert(holder: BaseDataBindingHolder<ItemWorkJobTypeBinding>, item: JobListBean) {
        holder.dataBinding!!.jobData = item
    }
}

class DeliverHistoryAdapter :
    BaseQuickAdapter<DeliverHistoryBean, BaseDataBindingHolder<ItemHistoryItemBinding>>(
        R.layout.item_history_item,
        mutableListOf()
    ) {
    override fun convert(
        holder: BaseDataBindingHolder<ItemHistoryItemBinding>,
        item: DeliverHistoryBean,
    ) {
        holder.dataBinding!!.data = item
    }
}

class WorkPersonInfoViewPager2Adapter(val fragment: Fragment) : FragmentStateAdapter(fragment) {
    override fun getItemCount(): Int {
        return 2
    }

    override fun createFragment(position: Int) = when (position) {
        0 ->
            ResumeManagerFragment()
        1 ->
            PersonSettingFragment()
        else ->
            PersonSettingFragment()
    }


}